<!DOCTYPE html>
<html>
<head>
    {include file="public/header" /}
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form layui-form-pane" action="" id="formInfo">
            <!--<fieldset class="table-search-fieldset">-->
            <!--<legend>搜索信息</legend>-->
            <div style="margin: 10px 10px 10px 10px">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">时间筛选</label>
                        <div class="layui-input-inline" style="width: 100px;">
                            <input type="text" name="searchTime_min" id="searchTime_min" placeholder="起始日期" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline" style="width: 100px;">
                            <input type="text" name="searchTime_max" id="searchTime_max" placeholder="结束日期" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">类型</label>
                        <div class="layui-input-inline" style="width: 100px;">
                            <select name="type" lay-filter="selectedInfo">
                                <option value=""></option>
                                <option value="1">转出</option>
                                <option value="2">转入</option>
                                <option value="3">系统赠送</option>
                                <option value="4">活动奖励</option>
                                <option value="5">推荐玩家</option>
                                <option value="6">联盟推荐</option>
                                <option value="7">市场收益</option>
                                <option value="8">摊位租金</option>
                                <option value="9">合成宝石</option>
                                <option value="10">兑换材料</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">筛选</label>
                        <div class="layui-input-inline" style="width: 100px;">
                            <select name="status" lay-filter="selectedInfo">
                                <option value=""></option>
                                <option value="1">支出</option>
                                <option value="2">收入</option>
                            </select>
                        </div>
                    </div>
                    <!--<div class="layui-inline">-->
                    <!--<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>-->
                    <!--</div>-->
                </div>

            </div>
            <!--</fieldset>-->
        </form>
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
    </div>
</div>
{include file="public/footer" /}
<!--类型-->
<script type="text/html" id="typeTpl">
    {{#  if(d.type === 1){ }}
    <span>转出</span>
    {{# }else if(d.type === 2){ }}
    <span>转入</span>
    {{# }else if(d.type === 3){ }}
    {{#  if(d.type_branch === 7){ }}
    <span>系统赠送---激活获得</span>
    {{# }else if(d.type_branch === 8){ }}
    <span>系统赠送---消费获得</span>
    {{#  } else { }}
    <span>系统赠送</span>
    {{#  } }}
    {{# }else if(d.type === 4){ }}
    {{#  if(d.type_branch === 1){ }}
    <span>活动赠送---转轮摇奖</span>
    {{# }else if(d.type_branch === 2){ }}
    <span>活动赠送---兑换获得</span>
    {{# }else if(d.type_branch === 3){ }}
    <span>活动赠送---任务奖励</span>
    {{# }else if(d.type_branch === 4){ }}
    <span>活动赠送---签到奖励</span>
    {{# }else if(d.type_branch === 5){ }}
    <span>活动赠送---答题奖励</span>
    {{#  } else { }}
    <span>活动赠送</span>
    {{#  } }}
    {{# }else if(d.type === 5){ }}
    <span>推荐玩家</span>
    {{# }else if(d.type === 6){ }}
    <span>联盟推荐</span>
    {{# }else if(d.type === 7){ }}
    <span>市场收益</span>
    {{# }else if(d.type === 8){ }}
    <span>摊位租金</span>
    {{# }else if(d.type === 9){ }}
    <span>合成宝石</span>
    {{# }else if(d.type === 10){ }}
    <span>兑换材料</span>
    {{# }else if(d.type === 11){ }}
    <span>驱逐成功</span>
    {{# }else if(d.type === 12){ }}
    <span>打劫成功</span>
    {{# }else if(d.type === 13){ }}
    <span>打劫失败</span>
    {{# }else if(d.type === 14){ }}
    <span>被打劫成功</span>
    {{# }else if(d.type === 15){ }}
    <span>卡券兑换</span>
    {{# }else if(d.type === 16){ }}
    <span>发红包</span>
    {{# }else if(d.type === 17){ }}
    <span>抢红包</span>
    {{# }else if(d.type === 18){ }}
    <span>积分兑换成金币</span>
    {{# }else if(d.type === 19){ }}
    <span>红包退回</span>
    {{# }else if(d.type === 20){ }}
    <span>金币充值</span>
    {{# }else if(d.type === 21){ }}
    <span>购买生意</span>
    {{# }else if(d.type === 22){ }}
    <span>出售生意</span>
    {{# }else if(d.type === 23){ }}
    <span>出售金币手续费</span>
    {{# }else if(d.type === 24){ }}
    <span>出售金币</span>
    {{# }else if(d.type === 25){ }}
    <span>购买金币</span>
    {{# }else if(d.type === 26){ }}
    <span>系统处罚</span>
    {{#  } else { }}
    <span>后台修改</span>
    {{#  } }}
</script>
<!--转入/转出的玩家-->
<script type="text/html" id="pCodeTpl">
    {{#  if(d.memberp_code != '' && d.memberp_code != null){ }}
    <span>{{d.pCode}}-{{d.memberp_code}}</span>
    {{#  } else { }}
    <span>\</span>
    {{#  } }}
</script>
<!--数量  正负-->
<script type="text/html" id="numTpl">
    {{#  if(d.type === 1 || d.type===8 || d.type===10 || d.type===13 || d.type===14 || d.type===16  || d.type===21 || d.type===23 || d.type===24 || d.type===26){ }}
    <span> <span style="color: red">-</span> {{d.gold_num}}</span>
    {{# }else if(d.type === -1){ }}
    <span>{{d.gold_num}}</span>
    {{#  } else { }}
    <span>+ {{d.gold_num}}</span>
    {{#  } }}
</script>

<script>
    layui.use(['form', 'table', 'laydate'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            laydate = layui.laydate;
        /*注册时间-最小*/
        laydate.render({
            elem: '#searchTime_min',
            done: function (value, date) {
                $('#searchTime_min').val(value);
                submitInfo();
            }
        });
        /*注册时间-最大*/
        laydate.render({
            elem: '#searchTime_max',
            done: function (value, date) {
                $('#searchTime_max').val(value);
                submitInfo();
            }
        });
        /*收益记录*/
        table.render({
            elem: '#currentTableId',
            url: '/admin/Member/goldLog',
            method: 'post',
            where: {memberCode: "{$memberCode}"},
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.data, //解析数据列表
                };
            },
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                {field: 'create_time', title: '日期', sort: true, align: 'center'},
                {field: 'type', title: '类型', sort: true, templet: '#typeTpl', align: 'center'},
                {field: 'gold_num', title: '数量', sort: true, align: 'center',templet: '#numTpl'},
                {field: 'pCode', title: '转入/转出的玩家', sort: true, align: 'center', templet: '#pCodeTpl'}
            ]],
            limits: [10, 15, 20, 25, 30, 50, 100],
            limit: 10,
            page: true,
            skin: 'line,row',
            done: function (res, curr, count) {

            }
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            submitInfo();
        });
        form.on('select(selectedInfo)', function (data) {
            submitInfo();
            return false;
        });

        function submitInfo() {
            var d = {};
            var t = $('#formInfo [name]').serializeArray();
            $.each(t, function () {
                d[this.name] = this.value;
            });
            var result = JSON.stringify(d);
            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: {
                    searchParams: result
                }
            }, 'data');
            return false;
        }

    });
</script>

</body>
</html>